package work13;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;


public class Task01 {
    public static void main(String[] args) throws IOException {
        HashMap<Integer,String> hashMap= new HashMap<Integer,String>();
        hashMap.put(1,"张三");
        hashMap.put(2, "李四");
        hashMap.put(3,"王五");
        hashMap.put(4,"赵六");
        hashMap.put(5,"小明");

        BufferedWriter bufferedWriter=new BufferedWriter(new FileWriter("d:\\abc.txt"));
        Iterator iterator=(Iterator)hashMap.keySet().iterator();
        while (iterator.hasNext()){
            Integer key=(Integer) iterator.next();
            String value=hashMap.get(key);
            bufferedWriter.write(key+"--"+value);
            bufferedWriter.newLine();
        }
        bufferedWriter.close();
    }
}
